#include "eventhandler.h"

#include "observable.h"

void Observable::AddListener(Listener* l) {
	m_Listeners.push_back(l);
}

void Observable::RemoveListener(Listener* l) {
}

void Observable::InformListeners(Event* e) {
	int i, n;
	EventHandler* eventHandler;

	eventHandler = EventHandler::GetInstance();
	n = m_Listeners.size();

	for(i = 0; i < n; i++) {
		EventMessage* mes = new EventMessage();
		mes->m_Event = e;
		mes->m_Destination = m_Listeners[i];

		eventHandler->SendEvent(mes);
	}
}